package com.abigdreamer.im.client.ui;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.JFrame;

import com.abigdreamer.im.client.resourse.ResourcesManagement;



public class BaseFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private  String owerID;                //登入此QQ的所有者
	private  String icon="ui/icon.png";
	private  String baseTitle="EIM客户端";   //标题

	public BaseFrame(){
		super();
		this.setTitle(baseTitle);
		Image image = ResourcesManagement.getImage(icon, 32, 32);
		this.setIconImage(image);
	}
	
	public static void intSubstance(){
//	 	JFrame.setDefaultLookAndFeelDecorated(true);
//        JDialog.setDefaultLookAndFeelDecorated(true);
//        try {
//            UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel());
//        } catch (UnsupportedLookAndFeelException ex) {
//            Logger.getLogger(BaseFrame.class.getName()).log(Level.SEVERE, null, ex);
//        }
	}
	
	public static void centerWindow(Container window) {
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		int w = window.getSize().width;
		int h = window.getSize().height;
		int x = (dim.width - w) / 2;
		int y = (dim.height - h) / 2;
		window.setLocation(x, y);
	}
	
	public static void leftWindow(Container window) {
		// get the size of the screen
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

		// determine the new location of the window
		int w = window.getSize().width;
		int h = window.getSize().height;
		
		int x = (dim.width - w);
		int y = (dim.height - h) / 2;

		// move the window
		window.setLocation(x, y);
	}

	public String getOwerID() {
		return owerID;
	}

	public void setOwerID(String owerID) {
		this.owerID = owerID;
	}

	public String getBaseTitle() {
		return baseTitle;
	}

	public void setBaseTitle(String baseTitle) {
		this.baseTitle = baseTitle;
	}
}
